package com.kt.kvw.util;

import com.kt.kvw.constant.ResultCodeConstants;
import com.kt.kvw.enums.ResultCodeEnum;
import com.kt.kvw.model.respone.ResponseData;

/**
 * Created with IntelliJ IDEA.
 * Desc:
 *
 * @author: keen
 * Date: 2020-07-04
 * Time: 23:27
 */
public class ResponseDataUtils {

    public static ResponseData success() {
        return new ResponseData(ResultCodeEnum.SUCCESS);
    }

    public static <T> ResponseData success(T detail) {
        return success("", detail);
    }

    public static <T> ResponseData success(String message, T detail) {
        return new ResponseData(true, ResultCodeConstants.SUCCESS_CODE, message, detail);
    }

    public static ResponseData fail() {
        return new ResponseData(ResultCodeEnum.FAIL);
    }

    public static ResponseData fail(ResultCodeEnum resultCode) {
        return new ResponseData(resultCode);
    }

    public static ResponseData fail(String message) {
        return fail(ResultCodeConstants.FAIL_CODE, message);
    }

    public static ResponseData fail(int code, String message) {
        return new ResponseData(false, code, message);
    }

}
